package com.ywu.application.standard.dataSource.api;

import com.ywu.common.result.CommonResult;
import com.ywu.application.standard.dataSource.dto.YwuDataSourceDto;
import com.ywu.application.standard.dataSource.service.YwuDataSourceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName YwuDataSourceApi
 * @Description TODO
 * @Author GroundDemo
 * @Date 2024/10/22 22:55
 * @Version 1.0
 **/
@RestController
@RequestMapping("/ywu/data/source")
public class YwuDataSourceApi {
    @Autowired
    private YwuDataSourceService service;

    /**
    * @Author GroundDemo
    * @Description 创建数据源
    * @Date 20:14 2024/10/25
    * @Param [ywuDataSourceDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/create.data.source.info")
    public CommonResult<Object> createDataSource(@RequestBody YwuDataSourceDto ywuDataSourceDto) {
        return service.createDataSource(ywuDataSourceDto);
    }

    /**
    * @Author GroundDemo
    * @Description 修改数据源
    * @Date 20:17 2024/10/25
    * @Param [ywuDataSourceDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/update.data.source.info")
    public CommonResult<Object> updateDataSource(@RequestBody YwuDataSourceDto ywuDataSourceDto) {
        return service.updateDataSource(ywuDataSourceDto);
    }

    /**
    * @Author GroundDemo
    * @Description 删除数据源
    * @Date 20:17 2024/10/25
    * @Param [ywuDataSourceDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/delete.data.source.info")
    public CommonResult<Object> deleteDataSource(@RequestBody YwuDataSourceDto ywuDataSourceDto) {
        return service.deleteDataSource(ywuDataSourceDto);
    }

    /**
    * @Author GroundDemo
    * @Description 分页查询数据源信息
    * @Date 20:20 2024/10/25
    * @Param [ywuDataSourceDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/query.data.source.info.page")
    public CommonResult<Object> queryDataSourcePage(@RequestBody YwuDataSourceDto ywuDataSourceDto) {
        return service.queryDataSourcePage(ywuDataSourceDto);
    }

    /**
    * @Author GroundDemo
    * @Description 更新是否租户共享
    * @Date 22:41 2024/10/27
    * @Param [ywuDataSourceDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/update.data.source.share.info")
    public CommonResult<Object> updateDataSourceShare(@RequestBody YwuDataSourceDto ywuDataSourceDto) {
        return service.updateDataSourceShare(ywuDataSourceDto);
    }
}
